#ifndef WXSITEMRES_H
#define WXSITEMRES_H

#include "wxwidgetsres.h"

class wxsItemEditor;
class wxsItemResData;


class wxsItemResFunctions {
  public:


    wxsItemResFunctions() {};


    virtual ~wxsItemResFunctions() {};


    virtual wxWindow* OnBuildExactPreview( wxWindow* Parent, wxsItemResData* Data ) = 0;
};


class wxsItemRes: public wxWidgetsRes, public wxsItemResFunctions {
    DECLARE_CLASS( wxsItemRes )
  public:


    enum EditMode { File, Source, Mixed };


    struct NewResourceParams {
      enum Scope {
        Public,
        Protected,
        Private
      };

      wxString Class;
      wxString Src;
      wxString Hdr;
      wxString Xrc;
      wxString Pch;
      wxString Wxs;
      wxString InitFunc;
      wxString BaseClass;
      wxString CustomCtorArgs;
      wxString PchGuard;
      bool GenSrc;
      bool GenHdr;
      bool GenXrc;
      bool UsePch;
      bool UseInitFunc;
      bool CtorParent;
      bool CtorParentDef;
      bool CtorId;
      bool CtorIdDef;
      bool CtorPos;
      bool CtorPosDef;
      bool CtorSize;
      bool CtorSizeDef;
      bool UseFwdDecl;
      bool UseI18n;
      Scope ScopeIds;
      Scope ScopeMembers;
      Scope ScopeHandlers;

      NewResourceParams():
        GenSrc( false ), GenHdr( false ), GenXrc( false ), UsePch( false ),
        UseInitFunc( false ), CtorParent( false ), CtorParentDef( false ),
        CtorId( false ), CtorIdDef( false ), CtorPos( false ), CtorPosDef( false ),
        CtorSize( false ), CtorSizeDef( false ), UseFwdDecl( false ), UseI18n( true ),
        ScopeIds( Protected ), ScopeMembers( Public ), ScopeHandlers( Private ) {}
    };


    wxsItemRes( wxsProject* Owner, const wxString& ResourceType, bool CanBeMain );


    wxsItemRes( const wxString& FileName, const TiXmlElement* XrcElem, const wxString& ResourceType );


    virtual ~wxsItemRes();


    virtual bool CreateNewResource( NewResourceParams& Params );

    inline const wxString& GetWxsFileName() { return m_WxsFileName; }
    inline const wxString& GetSrcFileName() { return m_SrcFileName; }
    inline const wxString& GetHdrFileName() { return m_HdrFileName; }
    inline const wxString& GetXrcFileName() { return m_XrcFileName; }


    EditMode GetEditMode();


    wxsItemResData* BuildResData( wxsItemEditor* Editor );

  protected:

    virtual wxsEditor* OnCreateEditor( wxWindow* Parent );
    virtual bool OnReadConfig( const TiXmlElement* Node );
    virtual bool OnWriteConfig( TiXmlElement* Node );
    virtual bool OnCanHandleFile( const wxString& FileName );
    virtual wxString OnGetDeclarationFile();
    virtual bool OnGetUsingXRC();
    virtual bool OnGetCanBeMain();
    virtual void OnFillPopupMenu( wxMenu* Menu );
    virtual bool OnPopupMenu( long Id );
    virtual bool OnDeleteCleanup( bool ShowDialog );

  private:

    virtual int OnGetTreeIcon();

    wxString m_WxsFileName;
    wxString m_SrcFileName;
    wxString m_HdrFileName;
    wxString m_XrcFileName;
    bool     m_UseForwardDeclarations;
    bool     m_UseI18n;
    bool     m_CanBeMain;
};

#endif
